package com.wxy.config;

import jakarta.annotation.PreDestroy;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author 47868
 */
@Configuration
public class ElasticConfig {
    private final RestHighLevelClient client;
    @Autowired
    public ElasticConfig(RestHighLevelClient client) {
        this.client = client;
    }
    @PreDestroy
    public void destroy() throws IOException {
        client.close();
    }
}
